package com.tinem.platform.web.auth.grant.client_credentials_custom;

import com.tinem.platform.web.auth.grant.client_credentials_user.ClientCredentialsUserAuthenticationProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.stereotype.Component;

@Component
public class ClientCredentialsCustomAuthenticationSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {

    @Autowired
    ClientCredentialsCustomAuthenticationProvider clientCredentialsCustomAuthenticationProvider;

    @Override
    public void configure(HttpSecurity http) throws Exception {
        // 将短信验证码校验器注册到 HttpSecurity， 并将短信验证码过滤器添加在 UsernamePasswordAuthenticationFilter 之前
        http.authenticationProvider(clientCredentialsCustomAuthenticationProvider);

    }
}